package _07线程控制;

public class MyThread extends Thread {

    boolean goon = true;

    @Override
    public void run() {
        System.out.println("运行状态 -》线程开始");
        int i = 0;
        while (i < 20 && goon) {
            i++;
            System.out.println("运行中" + i);
            try {
                // 阻塞状态 ，1000ms 后又恢复到可运行状态
                Thread.sleep(1000);


            } catch (InterruptedException e) {
                e.printStackTrace();
                break;
            }
        }
        System.out.println("线程结束");

    }
}
